package com.itheima.d2_buffered_stream;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test3 {
    public static void main(String[] args) {
        try (BufferedReader br = new BufferedReader(new FileReader("Day18-io-app\\src\\shuzi1"));
             BufferedWriter bw=new BufferedWriter(new FileWriter("Day18-io-app\\src\\shuzi2"));
        ){
            List<String> data =new ArrayList<>();

            String line;
            while ((line = br.readLine()) != null) {
                data.add(line);
            }
            Collections.sort(data);
            System.out.print(data);

            for (String da : data) {
                bw.write(da);
                bw.newLine();
            }



        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
